e98f7a
@@ -546,13 +546,11 @@
static long getLastFlushLength(FileSystem fs,
                                          Path deltaFile) throws IOException {
     Path lengths = OrcRecordUpdater.getSideFile(deltaFile);
     long result = Long.MAX_VALUE;
-    try {
-      FSDataInputStream stream = fs.open(lengths);
+    try (FSDataInputStream stream = fs.open(lengths)) {
       result = -1;
       while (stream.available() > 0) {
         result = stream.readLong();
       }
-      stream.close();
       return result;
     } catch (IOException ioe) {
       return result;
